package com.itheima.test6;

import java.io.OutputStream;
import java.net.Socket;

/**
 * @Author:gy
 * @Date: 2025/09/04 10:03
 * @Description:
 */
public class ClientDemo {
    public static void main(String[] args) throws Exception {
        //创建客户端的Socket对象,套接字对象与指定服务器连接
        Socket socket = new Socket("127.0.0.1",10000);
        //获取输出流,写数据
        OutputStream os = socket.getOutputStream();
        String str = "hello,tcp";
        os.write(str.getBytes());
        //释放资源
       // os.close();
        socket.close();
    }
}
